<?php


namespace apps\marriage\app\mp\controller;


use apps\marriage\core\service\ServicePackageService;
use think\Request;

class ServicePackageController extends BaseMarriageMpController
{
    /**
     * @var ServicePackageService
     */
    private $servicePackageService;

    protected function init()
    {
        parent::init();
        $this->servicePackageService = service('ServicePackage', SERVICE_NAMESPACE);
    }

    public function all()
    {
        $packages = $this->servicePackageService->getAll();
        return $this->success(['packages' => $packages]);
    }

    public function info(Request $request)
    {
        $id = $request->param('id', 0, 'intval');
        $package = $this->servicePackageService->getByPk($id);
        return $this->success(['package' => $package]);
    }
}